﻿using StoryTeller.Domain.Repository;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace StoryTeller.Domain
{
    public class Contribution : BaseDomain
    {
        public Contribution()
        {
            this.CreationDate = DateTime.Now;
            this.LastUpdate = DateTime.Now;
        }

        public Chapter Chapter { get; set; }

        public User Owner { get; set; }

        public bool IsPublic { get; set; }

        public string Text { get; set; }

        public override bool Validate()
        {
            ValidationMessages = new List<string>();

            if (string.IsNullOrEmpty(this.Text))
            {
                ValidationMessages.Add(Resources.Validation.ValidationMessages.ContributionTextMessage);
            }

            return ValidationMessages.Count > 0;
        }
    }
}
